package com.iversonx.responsibility_chain.example_1.v2.impl;

import com.iversonx.responsibility_chain.example_1.v1.FeeRequest;
import com.iversonx.responsibility_chain.example_1.v2.AbstractFeeRequestHandler;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Service;

/**
 * 项目经理审批费用申请
 **/
@Service
@Order(2)
public class DeptFeeRequestHandler extends AbstractFeeRequestHandler {
    
    @Override
    protected boolean support(double fee) {
        return fee < 5000;
    }
    
    @Override
    protected String doHandle(FeeRequest parameter) {
        String result;
        if("Lee".equalsIgnoreCase(parameter.getUsername())) {
            result = "同意";
        } else {
            result = "拒绝";
        }
        return "部门经理" + result + parameter.getUsername() + "的费用申请";
    }
}
